from fastapi import APIRouter, Depends

from common.pkg.fastapi_util import cbv
from common.utils.depends.tips_depends import get_login_tenant
from core.view import TenantBaseView
from service.pay_way_service import PayWayService

router = APIRouter(prefix="/pay_way", dependencies=[Depends(get_login_tenant)])


@cbv(router)
class PayWayView(TenantBaseView):
    @router.get("/", description="获取所有的支付方式")
    async def get_all_pay_way(self):
        pws = PayWayService(self.mgw, self.redis)
        ok, data_or_code = await pws.get_pay_way_list()
        return self.unpack_response(ok, data_or_code)

